fix(config): add config validation + deny_unknown_fields (#334 P3-core)#342
Merged
Conversation
Resolves the P3-core items from #334 — config values and profile values were accepted without semantic checks, so typos and out-of-range values propagated silently to runtime. #94 — Config::validate() at load time: - temperature 0.0..=2.0, max_tokens/timeout >= 1 - max_tokens_param, response_format, output.format, hook.mode/on_violation/min_severity - provider.base_url must have an http(s)/ws/unix scheme - multiple errors aggregated into one message #81 — Profile::validate(): focus weight 1-10, recognized action/tone/detail_level #57 — CategoryAction enum (case-insensitive deserialize): unknown values like 'blok' now fail loudly instead of silently becoming blocking #58 — evaluate() forces Pass when enabled=false (disabled gate never fails) #80 — deny_unknown_fields on all config sections: misspelled YAML keys (e.g. 'quailty_gate', 'temprature') rejected at parse time 24 new tests covering validation acceptance/rejection and deny_unknown_fields. All 637 tests pass; clippy + fmt clean. Refs #334
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves the P3-core items from #334. Config and profile values were accepted without semantic checks, so typos and out-of-range values propagated silently to runtime — config "appeared to work" but settings were ignored or produced wrong behavior.
Fixes
Config::validate()runs at load time:temperature(0.0–2.0),max_tokens/timeout(≥1),max_tokens_param,response_format,output.format,hook.mode/on_violation/min_severity,provider.base_urlscheme. Multiple errors aggregated.Profile::validate(): focusweight1–10, recognizedaction/tone/detail_level. All built-in profiles pass.CategoryActionenum with case-insensitive deserialization. A typo likebloknow fails loudly at config load instead of silently becoming a blocking failure.enabledflagevaluate()forcesGateStatus::Passwhenenabled: false. A disabled gate can never block a merge. Counts are still computed for reporting.#[serde(deny_unknown_fields)]on all config sections (CoraFile,ProviderSection,LlmSection,QualityGateConfig, …).quailty_gate/tempraturenow rejected at parse time.Design notes
warnand acceptsblock/warn/ignorecase-insensitively. CustomDeserializeimpl (Serialize still deriveslowercase).CheckResult.actionis nowOption<CategoryAction>.severity_counts_correct) while fixing the bug.info(used by the built-inclean-codeprofile's testing focus area), discovered viavalidate_accepts_all_builtinstest.ProfileRef/InlineProfileRef(untagged enums —deny_unknown_fieldsbreaks variant probing).Testing
cargo auditclean.Refs #334